#include <cmath>
#include <cstddef>
#include "vtr_color_map.h"
#include "vtr_assert.h"

namespace vtr {

//Inferno data from MatPlotLib
static std::vector<Color<float>> inferno_data = {
    {0.001462f, 0.000466f, 0.013866f},
    {0.002267f, 0.001270f, 0.018570f},
    {0.003299f, 0.002249f, 0.024239f},
    {0.004547f, 0.003392f, 0.030909f},
    {0.006006f, 0.004692f, 0.038558f},
    {0.007676f, 0.006136f, 0.046836f},
    {0.009561f, 0.007713f, 0.055143f},
    {0.011663f, 0.009417f, 0.063460f},
    {0.013995f, 0.011225f, 0.071862f},
    {0.016561f, 0.013136f, 0.080282f},
    {0.019373f, 0.015133f, 0.088767f},
    {0.022447f, 0.017199f, 0.097327f},
    {0.025793f, 0.019331f, 0.105930f},
    {0.029432f, 0.021503f, 0.114621f},
    {0.033385f, 0.023702f, 0.123397f},
    {0.037668f, 0.025921f, 0.132232f},
    {0.042253f, 0.028139f, 0.141141f},
    {0.046915f, 0.030324f, 0.150164f},
    {0.051644f, 0.032474f, 0.159254f},
    {0.056449f, 0.034569f, 0.168414f},
    {0.061340f, 0.036590f, 0.177642f},
    {0.066331f, 0.038504f, 0.186962f},
    {0.071429f, 0.040294f, 0.196354f},
    {0.076637f, 0.041905f, 0.205799f},
    {0.081962f, 0.043328f, 0.215289f},
    {0.087411f, 0.044556f, 0.224813f},
    {0.092990f, 0.045583f, 0.234358f},
    {0.098702f, 0.046402f, 0.243904f},
    {0.104551f, 0.047008f, 0.253430f},
    {0.110536f, 0.047399f, 0.262912f},
    {0.116656f, 0.047574f, 0.272321f},
    {0.122908f, 0.047536f, 0.281624f},
    {0.129285f, 0.047293f, 0.290788f},
    {0.135778f, 0.046856f, 0.299776f},
    {0.142378f, 0.046242f, 0.308553f},
    {0.149073f, 0.045468f, 0.317085f},
    {0.155850f, 0.044559f, 0.325338f},
    {0.162689f, 0.043554f, 0.333277f},
    {0.169575f, 0.042489f, 0.340874f},
    {0.176493f, 0.041402f, 0.348111f},
    {0.183429f, 0.040329f, 0.354971f},
    {0.190367f, 0.039309f, 0.361447f},
    {0.197297f, 0.038400f, 0.367535f},
    {0.204209f, 0.037632f, 0.373238f},
    {0.211095f, 0.037030f, 0.378563f},
    {0.217949f, 0.036615f, 0.383522f},
    {0.224763f, 0.036405f, 0.388129f},
    {0.231538f, 0.036405f, 0.392400f},
    {0.238273f, 0.036621f, 0.396353f},
    {0.244967f, 0.037055f, 0.400007f},
    {0.251620f, 0.037705f, 0.403378f},
    {0.258234f, 0.038571f, 0.406485f},
    {0.264810f, 0.039647f, 0.409345f},
    {0.271347f, 0.040922f, 0.411976f},
    {0.277850f, 0.042353f, 0.414392f},
    {0.284321f, 0.043933f, 0.416608f},
    {0.290763f, 0.045644f, 0.418637f},
    {0.297178f, 0.047470f, 0.420491f},
    {0.303568f, 0.049396f, 0.422182f},
    {0.309935f, 0.051407f, 0.423721f},
    {0.316282f, 0.053490f, 0.425116f},
    {0.322610f, 0.055634f, 0.426377f},
    {0.328921f, 0.057827f, 0.427511f},
    {0.335217f, 0.060060f, 0.428524f},
    {0.341500f, 0.062325f, 0.429425f},
    {0.347771f, 0.064616f, 0.430217f},
    {0.354032f, 0.066925f, 0.430906f},
    {0.360284f, 0.069247f, 0.431497f},
    {0.366529f, 0.071579f, 0.431994f},
    {0.372768f, 0.073915f, 0.432400f},
    {0.379001f, 0.076253f, 0.432719f},
    {0.385228f, 0.078591f, 0.432955f},
    {0.391453f, 0.080927f, 0.433109f},
    {0.397674f, 0.083257f, 0.433183f},
    {0.403894f, 0.085580f, 0.433179f},
    {0.410113f, 0.087896f, 0.433098f},
    {0.416331f, 0.090203f, 0.432943f},
    {0.422549f, 0.092501f, 0.432714f},
    {0.428768f, 0.094790f, 0.432412f},
    {0.434987f, 0.097069f, 0.432039f},
    {0.441207f, 0.099338f, 0.431594f},
    {0.447428f, 0.101597f, 0.431080f},
    {0.453651f, 0.103848f, 0.430498f},
    {0.459875f, 0.106089f, 0.429846f},
    {0.466100f, 0.108322f, 0.429125f},
    {0.472328f, 0.110547f, 0.428334f},
    {0.478558f, 0.112764f, 0.427475f},
    {0.484789f, 0.114974f, 0.426548f},
    {0.491022f, 0.117179f, 0.425552f},
    {0.497257f, 0.119379f, 0.424488f},
    {0.503493f, 0.121575f, 0.423356f},
    {0.509730f, 0.123769f, 0.422156f},
    {0.515967f, 0.125960f, 0.420887f},
    {0.522206f, 0.128150f, 0.419549f},
    {0.528444f, 0.130341f, 0.418142f},
    {0.534683f, 0.132534f, 0.416667f},
    {0.540920f, 0.134729f, 0.415123f},
    {0.547157f, 0.136929f, 0.413511f},
    {0.553392f, 0.139134f, 0.411829f},
    {0.559624f, 0.141346f, 0.410078f},
    {0.565854f, 0.143567f, 0.408258f},
    {0.572081f, 0.145797f, 0.406369f},
    {0.578304f, 0.148039f, 0.404411f},
    {0.584521f, 0.150294f, 0.402385f},
    {0.590734f, 0.152563f, 0.400290f},
    {0.596940f, 0.154848f, 0.398125f},
    {0.603139f, 0.157151f, 0.395891f},
    {0.609330f, 0.159474f, 0.393589f},
    {0.615513f, 0.161817f, 0.391219f},
    {0.621685f, 0.164184f, 0.388781f},
    {0.627847f, 0.166575f, 0.386276f},
    {0.633998f, 0.168992f, 0.383704f},
    {0.640135f, 0.171438f, 0.381065f},
    {0.646260f, 0.173914f, 0.378359f},
    {0.652369f, 0.176421f, 0.375586f},
    {0.658463f, 0.178962f, 0.372748f},
    {0.664540f, 0.181539f, 0.369846f},
    {0.670599f, 0.184153f, 0.366879f},
    {0.676638f, 0.186807f, 0.363849f},
    {0.682656f, 0.189501f, 0.360757f},
    {0.688653f, 0.192239f, 0.357603f},
    {0.694627f, 0.195021f, 0.354388f},
    {0.700576f, 0.197851f, 0.351113f},
    {0.706500f, 0.200728f, 0.347777f},
    {0.712396f, 0.203656f, 0.344383f},
    {0.718264f, 0.206636f, 0.340931f},
    {0.724103f, 0.209670f, 0.337424f},
    {0.729909f, 0.212759f, 0.333861f},
    {0.735683f, 0.215906f, 0.330245f},
    {0.741423f, 0.219112f, 0.326576f},
    {0.747127f, 0.222378f, 0.322856f},
    {0.752794f, 0.225706f, 0.319085f},
    {0.758422f, 0.229097f, 0.315266f},
    {0.764010f, 0.232554f, 0.311399f},
    {0.769556f, 0.236077f, 0.307485f},
    {0.775059f, 0.239667f, 0.303526f},
    {0.780517f, 0.243327f, 0.299523f},
    {0.785929f, 0.247056f, 0.295477f},
    {0.791293f, 0.250856f, 0.291390f},
    {0.796607f, 0.254728f, 0.287264f},
    {0.801871f, 0.258674f, 0.283099f},
    {0.807082f, 0.262692f, 0.278898f},
    {0.812239f, 0.266786f, 0.274661f},
    {0.817341f, 0.270954f, 0.270390f},
    {0.822386f, 0.275197f, 0.266085f},
    {0.827372f, 0.279517f, 0.261750f},
    {0.832299f, 0.283913f, 0.257383f},
    {0.837165f, 0.288385f, 0.252988f},
    {0.841969f, 0.292933f, 0.248564f},
    {0.846709f, 0.297559f, 0.244113f},
    {0.851384f, 0.302260f, 0.239636f},
    {0.855992f, 0.307038f, 0.235133f},
    {0.860533f, 0.311892f, 0.230606f},
    {0.865006f, 0.316822f, 0.226055f},
    {0.869409f, 0.321827f, 0.221482f},
    {0.873741f, 0.326906f, 0.216886f},
    {0.878001f, 0.332060f, 0.212268f},
    {0.882188f, 0.337287f, 0.207628f},
    {0.886302f, 0.342586f, 0.202968f},
    {0.890341f, 0.347957f, 0.198286f},
    {0.894305f, 0.353399f, 0.193584f},
    {0.898192f, 0.358911f, 0.188860f},
    {0.902003f, 0.364492f, 0.184116f},
    {0.905735f, 0.370140f, 0.179350f},
    {0.909390f, 0.375856f, 0.174563f},
    {0.912966f, 0.381636f, 0.169755f},
    {0.916462f, 0.387481f, 0.164924f},
    {0.919879f, 0.393389f, 0.160070f},
    {0.923215f, 0.399359f, 0.155193f},
    {0.926470f, 0.405389f, 0.150292f},
    {0.929644f, 0.411479f, 0.145367f},
    {0.932737f, 0.417627f, 0.140417f},
    {0.935747f, 0.423831f, 0.135440f},
    {0.938675f, 0.430091f, 0.130438f},
    {0.941521f, 0.436405f, 0.125409f},
    {0.944285f, 0.442772f, 0.120354f},
    {0.946965f, 0.449191f, 0.115272f},
    {0.949562f, 0.455660f, 0.110164f},
    {0.952075f, 0.462178f, 0.105031f},
    {0.954506f, 0.468744f, 0.099874f},
    {0.956852f, 0.475356f, 0.094695f},
    {0.959114f, 0.482014f, 0.089499f},
    {0.961293f, 0.488716f, 0.084289f},
    {0.963387f, 0.495462f, 0.079073f},
    {0.965397f, 0.502249f, 0.073859f},
    {0.967322f, 0.509078f, 0.068659f},
    {0.969163f, 0.515946f, 0.063488f},
    {0.970919f, 0.522853f, 0.058367f},
    {0.972590f, 0.529798f, 0.053324f},
    {0.974176f, 0.536780f, 0.048392f},
    {0.975677f, 0.543798f, 0.043618f},
    {0.977092f, 0.550850f, 0.039050f},
    {0.978422f, 0.557937f, 0.034931f},
    {0.979666f, 0.565057f, 0.031409f},
    {0.980824f, 0.572209f, 0.028508f},
    {0.981895f, 0.579392f, 0.026250f},
    {0.982881f, 0.586606f, 0.024661f},
    {0.983779f, 0.593849f, 0.023770f},
    {0.984591f, 0.601122f, 0.023606f},
    {0.985315f, 0.608422f, 0.024202f},
    {0.985952f, 0.615750f, 0.025592f},
    {0.986502f, 0.623105f, 0.027814f},
    {0.986964f, 0.630485f, 0.030908f},
    {0.987337f, 0.637890f, 0.034916f},
    {0.987622f, 0.645320f, 0.039886f},
    {0.987819f, 0.652773f, 0.045581f},
    {0.987926f, 0.660250f, 0.051750f},
    {0.987945f, 0.667748f, 0.058329f},
    {0.987874f, 0.675267f, 0.065257f},
    {0.987714f, 0.682807f, 0.072489f},
    {0.987464f, 0.690366f, 0.079990f},
    {0.987124f, 0.697944f, 0.087731f},
    {0.986694f, 0.705540f, 0.095694f},
    {0.986175f, 0.713153f, 0.103863f},
    {0.985566f, 0.720782f, 0.112229f},
    {0.984865f, 0.728427f, 0.120785f},
    {0.984075f, 0.736087f, 0.129527f},
    {0.983196f, 0.743758f, 0.138453f},
    {0.982228f, 0.751442f, 0.147565f},
    {0.981173f, 0.759135f, 0.156863f},
    {0.980032f, 0.766837f, 0.166353f},
    {0.978806f, 0.774545f, 0.176037f},
    {0.977497f, 0.782258f, 0.185923f},
    {0.976108f, 0.789974f, 0.196018f},
    {0.974638f, 0.797692f, 0.206332f},
    {0.973088f, 0.805409f, 0.216877f},
    {0.971468f, 0.813122f, 0.227658f},
    {0.969783f, 0.820825f, 0.238686f},
    {0.968041f, 0.828515f, 0.249972f},
    {0.966243f, 0.836191f, 0.261534f},
    {0.964394f, 0.843848f, 0.273391f},
    {0.962517f, 0.851476f, 0.285546f},
    {0.960626f, 0.859069f, 0.298010f},
    {0.958720f, 0.866624f, 0.310820f},
    {0.956834f, 0.874129f, 0.323974f},
    {0.954997f, 0.881569f, 0.337475f},
    {0.953215f, 0.888942f, 0.351369f},
    {0.951546f, 0.896226f, 0.365627f},
    {0.950018f, 0.903409f, 0.380271f},
    {0.948683f, 0.910473f, 0.395289f},
    {0.947594f, 0.917399f, 0.410665f},
    {0.946809f, 0.924168f, 0.426373f},
    {0.946392f, 0.930761f, 0.442367f},
    {0.946403f, 0.937159f, 0.458592f},
    {0.946903f, 0.943348f, 0.474970f},
    {0.947937f, 0.949318f, 0.491426f},
    {0.949545f, 0.955063f, 0.507860f},
    {0.951740f, 0.960587f, 0.524203f},
    {0.954529f, 0.965896f, 0.540361f},
    {0.957896f, 0.971003f, 0.556275f},
    {0.961812f, 0.975924f, 0.571925f},
    {0.966249f, 0.980678f, 0.587206f},
    {0.971162f, 0.985282f, 0.602154f},
    {0.976511f, 0.989753f, 0.616760f},
    {0.982257f, 0.994109f, 0.631017f},
    {0.988362f, 0.998364f, 0.644924f}};

//Plasma data from MatPlotLib
static std::vector<Color<float>> plasma_data = {
    {5.03832136e-02f, 2.98028976e-02f, 5.27974883e-01f},
    {6.35363639e-02f, 2.84259729e-02f, 5.33123681e-01f},
    {7.53531234e-02f, 2.72063728e-02f, 5.38007001e-01f},
    {8.62217979e-02f, 2.61253206e-02f, 5.42657691e-01f},
    {9.63786097e-02f, 2.51650976e-02f, 5.47103487e-01f},
    {1.05979704e-01f, 2.43092436e-02f, 5.51367851e-01f},
    {1.15123641e-01f, 2.35562500e-02f, 5.55467728e-01f},
    {1.23902903e-01f, 2.28781011e-02f, 5.59423480e-01f},
    {1.32380720e-01f, 2.22583774e-02f, 5.63250116e-01f},
    {1.40603076e-01f, 2.16866674e-02f, 5.66959485e-01f},
    {1.48606527e-01f, 2.11535876e-02f, 5.70561711e-01f},
    {1.56420649e-01f, 2.06507174e-02f, 5.74065446e-01f},
    {1.64069722e-01f, 2.01705326e-02f, 5.77478074e-01f},
    {1.71573925e-01f, 1.97063415e-02f, 5.80805890e-01f},
    {1.78950212e-01f, 1.92522243e-02f, 5.84054243e-01f},
    {1.86212958e-01f, 1.88029767e-02f, 5.87227661e-01f},
    {1.93374449e-01f, 1.83540593e-02f, 5.90329954e-01f},
    {2.00445260e-01f, 1.79015512e-02f, 5.93364304e-01f},
    {2.07434551e-01f, 1.74421086e-02f, 5.96333341e-01f},
    {2.14350298e-01f, 1.69729276e-02f, 5.99239207e-01f},
    {2.21196750e-01f, 1.64970484e-02f, 6.02083323e-01f},
    {2.27982971e-01f, 1.60071509e-02f, 6.04867403e-01f},
    {2.34714537e-01f, 1.55015065e-02f, 6.07592438e-01f},
    {2.41396253e-01f, 1.49791041e-02f, 6.10259089e-01f},
    {2.48032377e-01f, 1.44393586e-02f, 6.12867743e-01f},
    {2.54626690e-01f, 1.38820918e-02f, 6.15418537e-01f},
    {2.61182562e-01f, 1.33075156e-02f, 6.17911385e-01f},
    {2.67702993e-01f, 1.27162163e-02f, 6.20345997e-01f},
    {2.74190665e-01f, 1.21091423e-02f, 6.22721903e-01f},
    {2.80647969e-01f, 1.14875915e-02f, 6.25038468e-01f},
    {2.87076059e-01f, 1.08554862e-02f, 6.27294975e-01f},
    {2.93477695e-01f, 1.02128849e-02f, 6.29490490e-01f},
    {2.99855122e-01f, 9.56079551e-03f, 6.31623923e-01f},
    {3.06209825e-01f, 8.90185346e-03f, 6.33694102e-01f},
    {3.12543124e-01f, 8.23900704e-03f, 6.35699759e-01f},
    {3.18856183e-01f, 7.57551051e-03f, 6.37639537e-01f},
    {3.25150025e-01f, 6.91491734e-03f, 6.39512001e-01f},
    {3.31425547e-01f, 6.26107379e-03f, 6.41315649e-01f},
    {3.37683446e-01f, 5.61830889e-03f, 6.43048936e-01f},
    {3.43924591e-01f, 4.99053080e-03f, 6.44710195e-01f},
    {3.50149699e-01f, 4.38202557e-03f, 6.46297711e-01f},
    {3.56359209e-01f, 3.79781761e-03f, 6.47809772e-01f},
    {3.62553473e-01f, 3.24319591e-03f, 6.49244641e-01f},
    {3.68732762e-01f, 2.72370721e-03f, 6.50600561e-01f},
    {3.74897270e-01f, 2.24514897e-03f, 6.51875762e-01f},
    {3.81047116e-01f, 1.81356205e-03f, 6.53068467e-01f},
    {3.87182639e-01f, 1.43446923e-03f, 6.54176761e-01f},
    {3.93304010e-01f, 1.11388259e-03f, 6.55198755e-01f},
    {3.99410821e-01f, 8.59420809e-04f, 6.56132835e-01f},
    {4.05502914e-01f, 6.78091517e-04f, 6.56977276e-01f},
    {4.11580082e-01f, 5.77101735e-04f, 6.57730380e-01f},
    {4.17642063e-01f, 5.63847476e-04f, 6.58390492e-01f},
    {4.23688549e-01f, 6.45902780e-04f, 6.58956004e-01f},
    {4.29719186e-01f, 8.31008207e-04f, 6.59425363e-01f},
    {4.35733575e-01f, 1.12705875e-03f, 6.59797077e-01f},
    {4.41732123e-01f, 1.53984779e-03f, 6.60069009e-01f},
    {4.47713600e-01f, 2.07954744e-03f, 6.60240367e-01f},
    {4.53677394e-01f, 2.75470302e-03f, 6.60309966e-01f},
    {4.59622938e-01f, 3.57374415e-03f, 6.60276655e-01f},
    {4.65549631e-01f, 4.54518084e-03f, 6.60139383e-01f},
    {4.71456847e-01f, 5.67758762e-03f, 6.59897210e-01f},
    {4.77343929e-01f, 6.97958743e-03f, 6.59549311e-01f},
    {4.83210198e-01f, 8.45983494e-03f, 6.59094989e-01f},
    {4.89054951e-01f, 1.01269996e-02f, 6.58533677e-01f},
    {4.94877466e-01f, 1.19897486e-02f, 6.57864946e-01f},
    {5.00677687e-01f, 1.40550640e-02f, 6.57087561e-01f},
    {5.06454143e-01f, 1.63333443e-02f, 6.56202294e-01f},
    {5.12206035e-01f, 1.88332232e-02f, 6.55209222e-01f},
    {5.17932580e-01f, 2.15631918e-02f, 6.54108545e-01f},
    {5.23632990e-01f, 2.45316468e-02f, 6.52900629e-01f},
    {5.29306474e-01f, 2.77468735e-02f, 6.51586010e-01f},
    {5.34952244e-01f, 3.12170300e-02f, 6.50165396e-01f},
    {5.40569510e-01f, 3.49501310e-02f, 6.48639668e-01f},
    {5.46157494e-01f, 3.89540334e-02f, 6.47009884e-01f},
    {5.51715423e-01f, 4.31364795e-02f, 6.45277275e-01f},
    {5.57242538e-01f, 4.73307585e-02f, 6.43443250e-01f},
    {5.62738096e-01f, 5.15448092e-02f, 6.41509389e-01f},
    {5.68201372e-01f, 5.57776706e-02f, 6.39477440e-01f},
    {5.73631859e-01f, 6.00281369e-02f, 6.37348841e-01f},
    {5.79028682e-01f, 6.42955547e-02f, 6.35126108e-01f},
    {5.84391137e-01f, 6.85790261e-02f, 6.32811608e-01f},
    {5.89718606e-01f, 7.28775875e-02f, 6.30407727e-01f},
    {5.95010505e-01f, 7.71902878e-02f, 6.27916992e-01f},
    {6.00266283e-01f, 8.15161895e-02f, 6.25342058e-01f},
    {6.05485428e-01f, 8.58543713e-02f, 6.22685703e-01f},
    {6.10667469e-01f, 9.02039303e-02f, 6.19950811e-01f},
    {6.15811974e-01f, 9.45639838e-02f, 6.17140367e-01f},
    {6.20918555e-01f, 9.89336721e-02f, 6.14257440e-01f},
    {6.25986869e-01f, 1.03312160e-01f, 6.11305174e-01f},
    {6.31016615e-01f, 1.07698641e-01f, 6.08286774e-01f},
    {6.36007543e-01f, 1.12092335e-01f, 6.05205491e-01f},
    {6.40959444e-01f, 1.16492495e-01f, 6.02064611e-01f},
    {6.45872158e-01f, 1.20898405e-01f, 5.98867442e-01f},
    {6.50745571e-01f, 1.25309384e-01f, 5.95617300e-01f},
    {6.55579615e-01f, 1.29724785e-01f, 5.92317494e-01f},
    {6.60374266e-01f, 1.34143997e-01f, 5.88971318e-01f},
    {6.65129493e-01f, 1.38566428e-01f, 5.85582301e-01f},
    {6.69845385e-01f, 1.42991540e-01f, 5.82153572e-01f},
    {6.74522060e-01f, 1.47418835e-01f, 5.78688247e-01f},
    {6.79159664e-01f, 1.51847851e-01f, 5.75189431e-01f},
    {6.83758384e-01f, 1.56278163e-01f, 5.71660158e-01f},
    {6.88318440e-01f, 1.60709387e-01f, 5.68103380e-01f},
    {6.92840088e-01f, 1.65141174e-01f, 5.64521958e-01f},
    {6.97323615e-01f, 1.69573215e-01f, 5.60918659e-01f},
    {7.01769334e-01f, 1.74005236e-01f, 5.57296144e-01f},
    {7.06177590e-01f, 1.78437000e-01f, 5.53656970e-01f},
    {7.10548747e-01f, 1.82868306e-01f, 5.50003579e-01f},
    {7.14883195e-01f, 1.87298986e-01f, 5.46338299e-01f},
    {7.19181339e-01f, 1.91728906e-01f, 5.42663338e-01f},
    {7.23443604e-01f, 1.96157962e-01f, 5.38980786e-01f},
    {7.27670428e-01f, 2.00586086e-01f, 5.35292612e-01f},
    {7.31862231e-01f, 2.05013174e-01f, 5.31600995e-01f},
    {7.36019424e-01f, 2.09439071e-01f, 5.27908434e-01f},
    {7.40142557e-01f, 2.13863965e-01f, 5.24215533e-01f},
    {7.44232102e-01f, 2.18287899e-01f, 5.20523766e-01f},
    {7.48288533e-01f, 2.22710942e-01f, 5.16834495e-01f},
    {7.52312321e-01f, 2.27133187e-01f, 5.13148963e-01f},
    {7.56303937e-01f, 2.31554749e-01f, 5.09468305e-01f},
    {7.60263849e-01f, 2.35975765e-01f, 5.05793543e-01f},
    {7.64192516e-01f, 2.40396394e-01f, 5.02125599e-01f},
    {7.68090391e-01f, 2.44816813e-01f, 4.98465290e-01f},
    {7.71957916e-01f, 2.49237220e-01f, 4.94813338e-01f},
    {7.75795522e-01f, 2.53657797e-01f, 4.91170517e-01f},
    {7.79603614e-01f, 2.58078397e-01f, 4.87539124e-01f},
    {7.83382636e-01f, 2.62499662e-01f, 4.83917732e-01f},
    {7.87132978e-01f, 2.66921859e-01f, 4.80306702e-01f},
    {7.90855015e-01f, 2.71345267e-01f, 4.76706319e-01f},
    {7.94549101e-01f, 2.75770179e-01f, 4.73116798e-01f},
    {7.98215577e-01f, 2.80196901e-01f, 4.69538286e-01f},
    {8.01854758e-01f, 2.84625750e-01f, 4.65970871e-01f},
    {8.05466945e-01f, 2.89057057e-01f, 4.62414580e-01f},
    {8.09052419e-01f, 2.93491117e-01f, 4.58869577e-01f},
    {8.12611506e-01f, 2.97927865e-01f, 4.55337565e-01f},
    {8.16144382e-01f, 3.02368130e-01f, 4.51816385e-01f},
    {8.19651255e-01f, 3.06812282e-01f, 4.48305861e-01f},
    {8.23132309e-01f, 3.11260703e-01f, 4.44805781e-01f},
    {8.26587706e-01f, 3.15713782e-01f, 4.41315901e-01f},
    {8.30017584e-01f, 3.20171913e-01f, 4.37835947e-01f},
    {8.33422053e-01f, 3.24635499e-01f, 4.34365616e-01f},
    {8.36801237e-01f, 3.29104836e-01f, 4.30905052e-01f},
    {8.40155276e-01f, 3.33580106e-01f, 4.27454836e-01f},
    {8.43484103e-01f, 3.38062109e-01f, 4.24013059e-01f},
    {8.46787726e-01f, 3.42551272e-01f, 4.20579333e-01f},
    {8.50066132e-01f, 3.47048028e-01f, 4.17153264e-01f},
    {8.53319279e-01f, 3.51552815e-01f, 4.13734445e-01f},
    {8.56547103e-01f, 3.56066072e-01f, 4.10322469e-01f},
    {8.59749520e-01f, 3.60588229e-01f, 4.06916975e-01f},
    {8.62926559e-01f, 3.65119408e-01f, 4.03518809e-01f},
    {8.66077920e-01f, 3.69660446e-01f, 4.00126027e-01f},
    {8.69203436e-01f, 3.74211795e-01f, 3.96738211e-01f},
    {8.72302917e-01f, 3.78773910e-01f, 3.93354947e-01f},
    {8.75376149e-01f, 3.83347243e-01f, 3.89975832e-01f},
    {8.78422895e-01f, 3.87932249e-01f, 3.86600468e-01f},
    {8.81442916e-01f, 3.92529339e-01f, 3.83228622e-01f},
    {8.84435982e-01f, 3.97138877e-01f, 3.79860246e-01f},
    {8.87401682e-01f, 4.01761511e-01f, 3.76494232e-01f},
    {8.90339687e-01f, 4.06397694e-01f, 3.73130228e-01f},
    {8.93249647e-01f, 4.11047871e-01f, 3.69767893e-01f},
    {8.96131191e-01f, 4.15712489e-01f, 3.66406907e-01f},
    {8.98983931e-01f, 4.20391986e-01f, 3.63046965e-01f},
    {9.01807455e-01f, 4.25086807e-01f, 3.59687758e-01f},
    {9.04601295e-01f, 4.29797442e-01f, 3.56328796e-01f},
    {9.07364995e-01f, 4.34524335e-01f, 3.52969777e-01f},
    {9.10098088e-01f, 4.39267908e-01f, 3.49610469e-01f},
    {9.12800095e-01f, 4.44028574e-01f, 3.46250656e-01f},
    {9.15470518e-01f, 4.48806744e-01f, 3.42890148e-01f},
    {9.18108848e-01f, 4.53602818e-01f, 3.39528771e-01f},
    {9.20714383e-01f, 4.58417420e-01f, 3.36165582e-01f},
    {9.23286660e-01f, 4.63250828e-01f, 3.32800827e-01f},
    {9.25825146e-01f, 4.68103387e-01f, 3.29434512e-01f},
    {9.28329275e-01f, 4.72975465e-01f, 3.26066550e-01f},
    {9.30798469e-01f, 4.77867420e-01f, 3.22696876e-01f},
    {9.33232140e-01f, 4.82779603e-01f, 3.19325444e-01f},
    {9.35629684e-01f, 4.87712357e-01f, 3.15952211e-01f},
    {9.37990034e-01f, 4.92666544e-01f, 3.12575440e-01f},
    {9.40312939e-01f, 4.97642038e-01f, 3.09196628e-01f},
    {9.42597771e-01f, 5.02639147e-01f, 3.05815824e-01f},
    {9.44843893e-01f, 5.07658169e-01f, 3.02433101e-01f},
    {9.47050662e-01f, 5.12699390e-01f, 2.99048555e-01f},
    {9.49217427e-01f, 5.17763087e-01f, 2.95662308e-01f},
    {9.51343530e-01f, 5.22849522e-01f, 2.92274506e-01f},
    {9.53427725e-01f, 5.27959550e-01f, 2.88883445e-01f},
    {9.55469640e-01f, 5.33093083e-01f, 2.85490391e-01f},
    {9.57468770e-01f, 5.38250172e-01f, 2.82096149e-01f},
    {9.59424430e-01f, 5.43431038e-01f, 2.78700990e-01f},
    {9.61335930e-01f, 5.48635890e-01f, 2.75305214e-01f},
    {9.63202573e-01f, 5.53864931e-01f, 2.71909159e-01f},
    {9.65023656e-01f, 5.59118349e-01f, 2.68513200e-01f},
    {9.66798470e-01f, 5.64396327e-01f, 2.65117752e-01f},
    {9.68525639e-01f, 5.69699633e-01f, 2.61721488e-01f},
    {9.70204593e-01f, 5.75028270e-01f, 2.58325424e-01f},
    {9.71835007e-01f, 5.80382015e-01f, 2.54931256e-01f},
    {9.73416145e-01f, 5.85761012e-01f, 2.51539615e-01f},
    {9.74947262e-01f, 5.91165394e-01f, 2.48151200e-01f},
    {9.76427606e-01f, 5.96595287e-01f, 2.44766775e-01f},
    {9.77856416e-01f, 6.02050811e-01f, 2.41387186e-01f},
    {9.79232922e-01f, 6.07532077e-01f, 2.38013359e-01f},
    {9.80556344e-01f, 6.13039190e-01f, 2.34646316e-01f},
    {9.81825890e-01f, 6.18572250e-01f, 2.31287178e-01f},
    {9.83040742e-01f, 6.24131362e-01f, 2.27937141e-01f},
    {9.84198924e-01f, 6.29717516e-01f, 2.24595006e-01f},
    {9.85300760e-01f, 6.35329876e-01f, 2.21264889e-01f},
    {9.86345421e-01f, 6.40968508e-01f, 2.17948456e-01f},
    {9.87332067e-01f, 6.46633475e-01f, 2.14647532e-01f},
    {9.88259846e-01f, 6.52324832e-01f, 2.11364122e-01f},
    {9.89127893e-01f, 6.58042630e-01f, 2.08100426e-01f},
    {9.89935328e-01f, 6.63786914e-01f, 2.04858855e-01f},
    {9.90681261e-01f, 6.69557720e-01f, 2.01642049e-01f},
    {9.91364787e-01f, 6.75355082e-01f, 1.98452900e-01f},
    {9.91984990e-01f, 6.81179025e-01f, 1.95294567e-01f},
    {9.92540939e-01f, 6.87029567e-01f, 1.92170500e-01f},
    {9.93031693e-01f, 6.92906719e-01f, 1.89084459e-01f},
    {9.93456302e-01f, 6.98810484e-01f, 1.86040537e-01f},
    {9.93813802e-01f, 7.04740854e-01f, 1.83043180e-01f},
    {9.94103226e-01f, 7.10697814e-01f, 1.80097207e-01f},
    {9.94323596e-01f, 7.16681336e-01f, 1.77207826e-01f},
    {9.94473934e-01f, 7.22691379e-01f, 1.74380656e-01f},
    {9.94553260e-01f, 7.28727890e-01f, 1.71621733e-01f},
    {9.94560594e-01f, 7.34790799e-01f, 1.68937522e-01f},
    {9.94494964e-01f, 7.40880020e-01f, 1.66334918e-01f},
    {9.94355411e-01f, 7.46995448e-01f, 1.63821243e-01f},
    {9.94140989e-01f, 7.53136955e-01f, 1.61404226e-01f},
    {9.93850778e-01f, 7.59304390e-01f, 1.59091984e-01f},
    {9.93482190e-01f, 7.65498551e-01f, 1.56890625e-01f},
    {9.93033251e-01f, 7.71719833e-01f, 1.54807583e-01f},
    {9.92505214e-01f, 7.77966775e-01f, 1.52854862e-01f},
    {9.91897270e-01f, 7.84239120e-01f, 1.51041581e-01f},
    {9.91208680e-01f, 7.90536569e-01f, 1.49376885e-01f},
    {9.90438793e-01f, 7.96858775e-01f, 1.47869810e-01f},
    {9.89587065e-01f, 8.03205337e-01f, 1.46529128e-01f},
    {9.88647741e-01f, 8.09578605e-01f, 1.45357284e-01f},
    {9.87620557e-01f, 8.15977942e-01f, 1.44362644e-01f},
    {9.86509366e-01f, 8.22400620e-01f, 1.43556679e-01f},
    {9.85314198e-01f, 8.28845980e-01f, 1.42945116e-01f},
    {9.84031139e-01f, 8.35315360e-01f, 1.42528388e-01f},
    {9.82652820e-01f, 8.41811730e-01f, 1.42302653e-01f},
    {9.81190389e-01f, 8.48328902e-01f, 1.42278607e-01f},
    {9.79643637e-01f, 8.54866468e-01f, 1.42453425e-01f},
    {9.77994918e-01f, 8.61432314e-01f, 1.42808191e-01f},
    {9.76264977e-01f, 8.68015998e-01f, 1.43350944e-01f},
    {9.74443038e-01f, 8.74622194e-01f, 1.44061156e-01f},
    {9.72530009e-01f, 8.81250063e-01f, 1.44922913e-01f},
    {9.70532932e-01f, 8.87896125e-01f, 1.45918663e-01f},
    {9.68443477e-01f, 8.94563989e-01f, 1.47014438e-01f},
    {9.66271225e-01f, 9.01249365e-01f, 1.48179639e-01f},
    {9.64021057e-01f, 9.07950379e-01f, 1.49370428e-01f},
    {9.61681481e-01f, 9.14672479e-01f, 1.50520343e-01f},
    {9.59275646e-01f, 9.21406537e-01f, 1.51566019e-01f},
    {9.56808068e-01f, 9.28152065e-01f, 1.52409489e-01f},
    {9.54286813e-01f, 9.34907730e-01f, 1.52921158e-01f},
    {9.51726083e-01f, 9.41670605e-01f, 1.52925363e-01f},
    {9.49150533e-01f, 9.48434900e-01f, 1.52177604e-01f},
    {9.46602270e-01f, 9.55189860e-01f, 1.50327944e-01f},
    {9.44151742e-01f, 9.61916487e-01f, 1.46860789e-01f},
    {9.41896120e-01f, 9.68589814e-01f, 1.40955606e-01f},
    {9.40015097e-01f, 9.75158357e-01f, 1.31325517e-01f}};

//Viridis data from MatPlotLib
static std::vector<Color<float>> viridis_data = {
    {0.26700401f, 0.00487433f, 0.32941519f},
    {0.26851048f, 0.00960483f, 0.33542652f},
    {0.26994384f, 0.01462494f, 0.34137895f},
    {0.27130489f, 0.01994186f, 0.34726862f},
    {0.27259384f, 0.02556309f, 0.35309303f},
    {0.27380934f, 0.03149748f, 0.35885256f},
    {0.27495242f, 0.03775181f, 0.36454323f},
    {0.27602238f, 0.04416723f, 0.37016418f},
    {0.2770184f, 0.05034437f, 0.37571452f},
    {0.27794143f, 0.05632444f, 0.38119074f},
    {0.27879067f, 0.06214536f, 0.38659204f},
    {0.2795655f, 0.06783587f, 0.39191723f},
    {0.28026658f, 0.07341724f, 0.39716349f},
    {0.28089358f, 0.07890703f, 0.40232944f},
    {0.28144581f, 0.0843197f, 0.40741404f},
    {0.28192358f, 0.08966622f, 0.41241521f},
    {0.28232739f, 0.09495545f, 0.41733086f},
    {0.28265633f, 0.10019576f, 0.42216032f},
    {0.28291049f, 0.10539345f, 0.42690202f},
    {0.28309095f, 0.11055307f, 0.43155375f},
    {0.28319704f, 0.11567966f, 0.43611482f},
    {0.28322882f, 0.12077701f, 0.44058404f},
    {0.28318684f, 0.12584799f, 0.44496f},
    {0.283072f, 0.13089477f, 0.44924127f},
    {0.28288389f, 0.13592005f, 0.45342734f},
    {0.28262297f, 0.14092556f, 0.45751726f},
    {0.28229037f, 0.14591233f, 0.46150995f},
    {0.28188676f, 0.15088147f, 0.46540474f},
    {0.28141228f, 0.15583425f, 0.46920128f},
    {0.28086773f, 0.16077132f, 0.47289909f},
    {0.28025468f, 0.16569272f, 0.47649762f},
    {0.27957399f, 0.17059884f, 0.47999675f},
    {0.27882618f, 0.1754902f, 0.48339654f},
    {0.27801236f, 0.18036684f, 0.48669702f},
    {0.27713437f, 0.18522836f, 0.48989831f},
    {0.27619376f, 0.19007447f, 0.49300074f},
    {0.27519116f, 0.1949054f, 0.49600488f},
    {0.27412802f, 0.19972086f, 0.49891131f},
    {0.27300596f, 0.20452049f, 0.50172076f},
    {0.27182812f, 0.20930306f, 0.50443413f},
    {0.27059473f, 0.21406899f, 0.50705243f},
    {0.26930756f, 0.21881782f, 0.50957678f},
    {0.26796846f, 0.22354911f, 0.5120084f},
    {0.26657984f, 0.2282621f, 0.5143487f},
    {0.2651445f, 0.23295593f, 0.5165993f},
    {0.2636632f, 0.23763078f, 0.51876163f},
    {0.26213801f, 0.24228619f, 0.52083736f},
    {0.26057103f, 0.2469217f, 0.52282822f},
    {0.25896451f, 0.25153685f, 0.52473609f},
    {0.25732244f, 0.2561304f, 0.52656332f},
    {0.25564519f, 0.26070284f, 0.52831152f},
    {0.25393498f, 0.26525384f, 0.52998273f},
    {0.25219404f, 0.26978306f, 0.53157905f},
    {0.25042462f, 0.27429024f, 0.53310261f},
    {0.24862899f, 0.27877509f, 0.53455561f},
    {0.2468114f, 0.28323662f, 0.53594093f},
    {0.24497208f, 0.28767547f, 0.53726018f},
    {0.24311324f, 0.29209154f, 0.53851561f},
    {0.24123708f, 0.29648471f, 0.53970946f},
    {0.23934575f, 0.30085494f, 0.54084398f},
    {0.23744138f, 0.30520222f, 0.5419214f},
    {0.23552606f, 0.30952657f, 0.54294396f},
    {0.23360277f, 0.31382773f, 0.54391424f},
    {0.2316735f, 0.3181058f, 0.54483444f},
    {0.22973926f, 0.32236127f, 0.54570633f},
    {0.22780192f, 0.32659432f, 0.546532f},
    {0.2258633f, 0.33080515f, 0.54731353f},
    {0.22392515f, 0.334994f, 0.54805291f},
    {0.22198915f, 0.33916114f, 0.54875211f},
    {0.22005691f, 0.34330688f, 0.54941304f},
    {0.21812995f, 0.34743154f, 0.55003755f},
    {0.21620971f, 0.35153548f, 0.55062743f},
    {0.21429757f, 0.35561907f, 0.5511844f},
    {0.21239477f, 0.35968273f, 0.55171011f},
    {0.2105031f, 0.36372671f, 0.55220646f},
    {0.20862342f, 0.36775151f, 0.55267486f},
    {0.20675628f, 0.37175775f, 0.55311653f},
    {0.20490257f, 0.37574589f, 0.55353282f},
    {0.20306309f, 0.37971644f, 0.55392505f},
    {0.20123854f, 0.38366989f, 0.55429441f},
    {0.1994295f, 0.38760678f, 0.55464205f},
    {0.1976365f, 0.39152762f, 0.55496905f},
    {0.19585993f, 0.39543297f, 0.55527637f},
    {0.19410009f, 0.39932336f, 0.55556494f},
    {0.19235719f, 0.40319934f, 0.55583559f},
    {0.19063135f, 0.40706148f, 0.55608907f},
    {0.18892259f, 0.41091033f, 0.55632606f},
    {0.18723083f, 0.41474645f, 0.55654717f},
    {0.18555593f, 0.4185704f, 0.55675292f},
    {0.18389763f, 0.42238275f, 0.55694377f},
    {0.18225561f, 0.42618405f, 0.5571201f},
    {0.18062949f, 0.42997486f, 0.55728221f},
    {0.17901879f, 0.43375572f, 0.55743035f},
    {0.17742298f, 0.4375272f, 0.55756466f},
    {0.17584148f, 0.44128981f, 0.55768526f},
    {0.17427363f, 0.4450441f, 0.55779216f},
    {0.17271876f, 0.4487906f, 0.55788532f},
    {0.17117615f, 0.4525298f, 0.55796464f},
    {0.16964573f, 0.45626209f, 0.55803034f},
    {0.16812641f, 0.45998802f, 0.55808199f},
    {0.1666171f, 0.46370813f, 0.55811913f},
    {0.16511703f, 0.4674229f, 0.55814141f},
    {0.16362543f, 0.47113278f, 0.55814842f},
    {0.16214155f, 0.47483821f, 0.55813967f},
    {0.16066467f, 0.47853961f, 0.55811466f},
    {0.15919413f, 0.4822374f, 0.5580728f},
    {0.15772933f, 0.48593197f, 0.55801347f},
    {0.15626973f, 0.4896237f, 0.557936f},
    {0.15481488f, 0.49331293f, 0.55783967f},
    {0.15336445f, 0.49700003f, 0.55772371f},
    {0.1519182f, 0.50068529f, 0.55758733f},
    {0.15047605f, 0.50436904f, 0.55742968f},
    {0.14903918f, 0.50805136f, 0.5572505f},
    {0.14760731f, 0.51173263f, 0.55704861f},
    {0.14618026f, 0.51541316f, 0.55682271f},
    {0.14475863f, 0.51909319f, 0.55657181f},
    {0.14334327f, 0.52277292f, 0.55629491f},
    {0.14193527f, 0.52645254f, 0.55599097f},
    {0.14053599f, 0.53013219f, 0.55565893f},
    {0.13914708f, 0.53381201f, 0.55529773f},
    {0.13777048f, 0.53749213f, 0.55490625f},
    {0.1364085f, 0.54117264f, 0.55448339f},
    {0.13506561f, 0.54485335f, 0.55402906f},
    {0.13374299f, 0.54853458f, 0.55354108f},
    {0.13244401f, 0.55221637f, 0.55301828f},
    {0.13117249f, 0.55589872f, 0.55245948f},
    {0.1299327f, 0.55958162f, 0.55186354f},
    {0.12872938f, 0.56326503f, 0.55122927f},
    {0.12756771f, 0.56694891f, 0.55055551f},
    {0.12645338f, 0.57063316f, 0.5498411f},
    {0.12539383f, 0.57431754f, 0.54908564f},
    {0.12439474f, 0.57800205f, 0.5482874f},
    {0.12346281f, 0.58168661f, 0.54744498f},
    {0.12260562f, 0.58537105f, 0.54655722f},
    {0.12183122f, 0.58905521f, 0.54562298f},
    {0.12114807f, 0.59273889f, 0.54464114f},
    {0.12056501f, 0.59642187f, 0.54361058f},
    {0.12009154f, 0.60010387f, 0.54253043f},
    {0.11973756f, 0.60378459f, 0.54139999f},
    {0.11951163f, 0.60746388f, 0.54021751f},
    {0.11942341f, 0.61114146f, 0.53898192f},
    {0.11948255f, 0.61481702f, 0.53769219f},
    {0.11969858f, 0.61849025f, 0.53634733f},
    {0.12008079f, 0.62216081f, 0.53494633f},
    {0.12063824f, 0.62582833f, 0.53348834f},
    {0.12137972f, 0.62949242f, 0.53197275f},
    {0.12231244f, 0.63315277f, 0.53039808f},
    {0.12344358f, 0.63680899f, 0.52876343f},
    {0.12477953f, 0.64046069f, 0.52706792f},
    {0.12632581f, 0.64410744f, 0.52531069f},
    {0.12808703f, 0.64774881f, 0.52349092f},
    {0.13006688f, 0.65138436f, 0.52160791f},
    {0.13226797f, 0.65501363f, 0.51966086f},
    {0.13469183f, 0.65863619f, 0.5176488f},
    {0.13733921f, 0.66225157f, 0.51557101f},
    {0.14020991f, 0.66585927f, 0.5134268f},
    {0.14330291f, 0.66945881f, 0.51121549f},
    {0.1466164f, 0.67304968f, 0.50893644f},
    {0.15014782f, 0.67663139f, 0.5065889f},
    {0.15389405f, 0.68020343f, 0.50417217f},
    {0.15785146f, 0.68376525f, 0.50168574f},
    {0.16201598f, 0.68731632f, 0.49912906f},
    {0.1663832f, 0.69085611f, 0.49650163f},
    {0.1709484f, 0.69438405f, 0.49380294f},
    {0.17570671f, 0.6978996f, 0.49103252f},
    {0.18065314f, 0.70140222f, 0.48818938f},
    {0.18578266f, 0.70489133f, 0.48527326f},
    {0.19109018f, 0.70836635f, 0.48228395f},
    {0.19657063f, 0.71182668f, 0.47922108f},
    {0.20221902f, 0.71527175f, 0.47608431f},
    {0.20803045f, 0.71870095f, 0.4728733f},
    {0.21400015f, 0.72211371f, 0.46958774f},
    {0.22012381f, 0.72550945f, 0.46622638f},
    {0.2263969f, 0.72888753f, 0.46278934f},
    {0.23281498f, 0.73224735f, 0.45927675f},
    {0.2393739f, 0.73558828f, 0.45568838f},
    {0.24606968f, 0.73890972f, 0.45202405f},
    {0.25289851f, 0.74221104f, 0.44828355f},
    {0.25985676f, 0.74549162f, 0.44446673f},
    {0.26694127f, 0.74875084f, 0.44057284f},
    {0.27414922f, 0.75198807f, 0.4366009f},
    {0.28147681f, 0.75520266f, 0.43255207f},
    {0.28892102f, 0.75839399f, 0.42842626f},
    {0.29647899f, 0.76156142f, 0.42422341f},
    {0.30414796f, 0.76470433f, 0.41994346f},
    {0.31192534f, 0.76782207f, 0.41558638f},
    {0.3198086f, 0.77091403f, 0.41115215f},
    {0.3277958f, 0.77397953f, 0.40664011f},
    {0.33588539f, 0.7770179f, 0.40204917f},
    {0.34407411f, 0.78002855f, 0.39738103f},
    {0.35235985f, 0.78301086f, 0.39263579f},
    {0.36074053f, 0.78596419f, 0.38781353f},
    {0.3692142f, 0.78888793f, 0.38291438f},
    {0.37777892f, 0.79178146f, 0.3779385f},
    {0.38643282f, 0.79464415f, 0.37288606f},
    {0.39517408f, 0.79747541f, 0.36775726f},
    {0.40400101f, 0.80027461f, 0.36255223f},
    {0.4129135f, 0.80304099f, 0.35726893f},
    {0.42190813f, 0.80577412f, 0.35191009f},
    {0.43098317f, 0.80847343f, 0.34647607f},
    {0.44013691f, 0.81113836f, 0.3409673f},
    {0.44936763f, 0.81376835f, 0.33538426f},
    {0.45867362f, 0.81636288f, 0.32972749f},
    {0.46805314f, 0.81892143f, 0.32399761f},
    {0.47750446f, 0.82144351f, 0.31819529f},
    {0.4870258f, 0.82392862f, 0.31232133f},
    {0.49661536f, 0.82637633f, 0.30637661f},
    {0.5062713f, 0.82878621f, 0.30036211f},
    {0.51599182f, 0.83115784f, 0.29427888f},
    {0.52577622f, 0.83349064f, 0.2881265f},
    {0.5356211f, 0.83578452f, 0.28190832f},
    {0.5455244f, 0.83803918f, 0.27562602f},
    {0.55548397f, 0.84025437f, 0.26928147f},
    {0.5654976f, 0.8424299f, 0.26287683f},
    {0.57556297f, 0.84456561f, 0.25641457f},
    {0.58567772f, 0.84666139f, 0.24989748f},
    {0.59583934f, 0.84871722f, 0.24332878f},
    {0.60604528f, 0.8507331f, 0.23671214f},
    {0.61629283f, 0.85270912f, 0.23005179f},
    {0.62657923f, 0.85464543f, 0.22335258f},
    {0.63690157f, 0.85654226f, 0.21662012f},
    {0.64725685f, 0.85839991f, 0.20986086f},
    {0.65764197f, 0.86021878f, 0.20308229f},
    {0.66805369f, 0.86199932f, 0.19629307f},
    {0.67848868f, 0.86374211f, 0.18950326f},
    {0.68894351f, 0.86544779f, 0.18272455f},
    {0.69941463f, 0.86711711f, 0.17597055f},
    {0.70989842f, 0.86875092f, 0.16925712f},
    {0.72039115f, 0.87035015f, 0.16260273f},
    {0.73088902f, 0.87191584f, 0.15602894f},
    {0.74138803f, 0.87344918f, 0.14956101f},
    {0.75188414f, 0.87495143f, 0.14322828f},
    {0.76237342f, 0.87642392f, 0.13706449f},
    {0.77285183f, 0.87786808f, 0.13110864f},
    {0.78331535f, 0.87928545f, 0.12540538f},
    {0.79375994f, 0.88067763f, 0.12000532f},
    {0.80418159f, 0.88204632f, 0.11496505f},
    {0.81457634f, 0.88339329f, 0.11034678f},
    {0.82494028f, 0.88472036f, 0.10621724f},
    {0.83526959f, 0.88602943f, 0.1026459f},
    {0.84556056f, 0.88732243f, 0.09970219f},
    {0.8558096f, 0.88860134f, 0.09745186f},
    {0.86601325f, 0.88986815f, 0.09595277f},
    {0.87616824f, 0.89112487f, 0.09525046f},
    {0.88627146f, 0.89237353f, 0.09537439f},
    {0.89632002f, 0.89361614f, 0.09633538f},
    {0.90631121f, 0.89485467f, 0.09812496f},
    {0.91624212f, 0.89609127f, 0.1007168f},
    {0.92610579f, 0.89732977f, 0.10407067f},
    {0.93590444f, 0.8985704f, 0.10813094f},
    {0.94563626f, 0.899815f, 0.11283773f},
    {0.95529972f, 0.90106534f, 0.11812832f},
    {0.96489353f, 0.90232311f, 0.12394051f},
    {0.97441665f, 0.90358991f, 0.13021494f},
    {0.98386829f, 0.90486726f, 0.13689671f},
    {0.99324789f, 0.90615657f, 0.1439362f}};

ColorMap::ColorMap(float min_val, float max_val, const std::vector<Color<float>>& color_data)
    : min_(min_val)
    , max_(max_val)
    , color_data_(color_data) {
    VTR_ASSERT(max_ >= min_);
}

Color<float> ColorMap::color(float value) const {
    VTR_ASSERT(value >= min_);
    VTR_ASSERT(value <= max_);

    float norm_value;
    if (range() == 0) {
        norm_value = 0;
    } else {
        norm_value = (value - min_) / range();
    }

    size_t color_idx = std::round(norm_value * (color_data_.size() - 1));

    VTR_ASSERT(color_idx < color_data_.size());

    return color_data_[color_idx];
}

float ColorMap::min() const {
    return min_;
}

float ColorMap::max() const {
    return max_;
}

float ColorMap::range() const {
    return max() - min();
}

InfernoColorMap::InfernoColorMap(float min_val, float max_val)
    : ColorMap(min_val, max_val, inferno_data) {}

PlasmaColorMap::PlasmaColorMap(float min_val, float max_val)
    : ColorMap(min_val, max_val, plasma_data) {}

ViridisColorMap::ViridisColorMap(float min_val, float max_val)
    : ColorMap(min_val, max_val, viridis_data) {}

} // namespace vtr
